/**
* jQuery.dialog - dialog realized with div 
* Written by lofei (lofei117@gmail.com)
* Date: 2012/2/12
*
* @author Lofei Lin
* @version 1.0.0
*
**/

new function() {
	jQuery.dialog = {
			/**
			 * open函数，通过此函数调用对话框
			 * @param dialogHtml 对话框的html内容，用字符串表示
			 * @param G 确认按钮的执行函数
			 * @param target 用于存放对话框的父容器
			 */
		open : function(/*width, height, */dialogHtml, G, target) {
			if(target==null || target===undefined || target=="")target="body";
			var _client_width = $(document).width();
			var _client_height = $(document).height();
			$("<div/>").css({
				"position" : "absolute",
				"width" : _client_width,
				"height" : _client_height,
				"zIndex" : 990,
				"background-color" : "#000000",
				"filter" : "alpha(opacity = 25)",
				"-moz-opacity" : 0.25,
				"opacity" : 0.25
			}).attr('id', 'jd_shadow').html('&nbsp;').prependTo("body");
			$("<div/>").css({
				"position" : "absolute",
				//"width" : width,
				//"height" : height,
				"zIndex" : 991,
				"border" : "1px solid",
				"left" : _client_width / 3,
				"top" : 100,
				"background-color" : "#FFFFFF",
				"filter" : "alpha(opacity = 90)",
				"-moz-opacity" : 0.9,
				"opacity" : 0.9
			}).attr('id', 'jd_dialog').html(dialogHtml).prependTo(target);
			if(jQuery.isFunction(G)){
				$('#okBt').bind('click',G);
			}
			$('#cancelBt').bind('click',jQuery.dialog.close);
			//$('#okBt').click(jQuery.dialog.close);
			//$('#cancelBt').click(jQuery.dialog.close);
		},
		/**
		 * 关闭函数，移除对话框和屏蔽层
		 */
		close : function() {
			$('#jd_shadow').remove();
			$('#jd_dialog').remove();
		}
	};
}(jQuery.dialog || {});